/*
 * SonarQube
 * Copyright (C) 2009-2017 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
@import (reference) "../../variables";
@import (reference) "../../mixins";
@import (reference) "config";


.navigator-filters {
  padding-right: 85px;
  background-color: @navigatorBarBackground;
  font-size: 0;
}

.navigator-filters-list {
  display: inline-block;
  vertical-align: middle;
  font-size: 0;
  margin-bottom: -1px;
}

.navigator-filter-submit,
.navigator-filter-new-search {
  vertical-align: middle;
  margin-left: 15px;
  font-size: @baseFontSize;
}

.navigator-filter-submit {
  position: absolute;
  bottom: 0; right: 0;
  width: 85px;
  height: @navigatorFiltersHeight;
  margin: -1px -1px -1px 0;
  padding: 0;
  border: 1px solid darken(@blue, 10%);
  background: @blue;
  color: #fff;
  font-weight: normal;
  transition: all 0.2s ease;

  &::-moz-focus-inner { border: 0; }

  &:hover, &:focus {
    border-color: @blue;
    background-color: lighten(@blue, 10%);
  }
}

.navigator-filter-list-favorite {
  position: relative;
  padding-left: 36px;
  overflow: hidden;
}

.navigator-filters-actions {
  display: inline-block;
  vertical-align: middle;
  margin-left: 20px;
  font-size: @baseFontSize;
}

.navigator-filter {
  position: relative;
  z-index: @normal-z-index;
  display: inline-block;
  vertical-align: top;
  height: @navigatorFiltersHeight;
  line-height: @navigatorFiltersLineHeight;
  margin: -1px 0 0 -1px;
  padding: 0 1.5 * @navigatorFilterPadding;
  border: 1px solid @navigatorBorderLightColor;
  box-sizing: border-box;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    z-index: @above-normal-z-index;
    border-color: @navigatorBorderColor;
    background-color: @navigatorHover;
  }

  &.active {
    border-color: @darkGrey;
    background: #fff;
  }

}

.navigator-filter-disabled {
  display: none;
}

.navigator-filter-optional {
  padding-right: 0;
}

.navigator-filter-inline,
.navigator-filter-read-only,
.navigator-filter-inactive {
  cursor: default;

  &:hover,
  &.active {
    border-color: transparent;
    background: transparent;
  }
}

.navigator-filter-inline .navigator-filter-label:after {
    content: "";
}

.navigator-filter-inactive {
  opacity: 0.5;
}

.navigator-filter-context {
  z-index: @navigator-filter-context-z-index;
  background-color: @contextBackground;
  border-color: @contextBorder;
}

.navigator-filter-label {
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
  color: #333;
  font-size: @baseFontSize;

  &:after { content: ":"; }
}

.navigator-filter-value {
  display: inline-block;
  vertical-align: middle;
  max-width: 120px;
  color: #333;
  font-size: @baseFontSize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  &.default {
    color: #666;
  }
}

.navigator-filter-disable {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 20px;
  line-height: 20px;
  margin: 0 0 0 5px;
  font-size: 18px;
  text-align: center;
  transition: background 0.3s ease;

  &:hover {
    background-color: darken(@navigatorHover, 7%);
  }
}

.navigator-filter-range-input {
  width: 120px;
}

.navigator-filter-details {
  display: none;
  position: absolute;
  z-index: @dropdown-menu-z-index;
  min-width: 100px;
  border: 1px solid @darkGrey;
  background: #fff;
  box-shadow: @defaultShadow;
  font-size: @baseFontSize;
  transition: opacity 0.3s ease;

  &.active {
    display: block;
  }
}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  /* IE10+ specific styles go here */
  .navigator-filter-details {
    width: 250px;
  }
}

.navigator-filter-details-inner {
  max-width: 300px;
  padding: 5px @navigatorFilterPadding;

  .select2-container,
  input {
    margin: 5px 0;
    vertical-align: middle;
  }
}

.navigator-filter-select-list {
  min-width: 150px;
  max-width: 300px;
  max-height: 182px;
  padding: 5px 0;
  overflow-y: auto;
  -ms-overflow-style: scrollbar;

  label {
    display: block;
    padding: 5px @navigatorFilterPadding;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s ease;

    &:hover,
    &.current {
      background-color: darken(#fff, 7%);
    }

    & > input[type=checkbox] {
      vertical-align: baseline;
      cursor: pointer;
    }

    & > img {
      vertical-align: text-bottom;
    }

    &.special {
      font-style: italic;

      & > span {
        text-decoration: underline;
      }
    }

    &.inactive {
      cursor: default;
      opacity: 0.5;

      &:hover {
        background-color: transparent;
      }
    }
  }

  .single {
    padding: 5px @navigatorFilterPadding;
  }

  .line {
    height: 1px;
    margin: 5px 0;
    background: @darkGrey;
  }
}

.navigator-filter-select-list:not(.hidden) + .navigator-filter-select-list {
  margin-top: 5px;
  border-top: 1px solid @darkGrey;
}

.navigator-filter-search {
  position: relative;
  margin: @navigatorFilterPadding 26px @navigatorFilterPadding @navigatorFilterPadding;

  input {
    width: 100%;
    height: 26px;
    padding: 0 7px;
    border: 1px solid @darkGrey;
    box-sizing: border-box;
  }

  .fetching &:after {
    content: ' ';
    position: absolute;
    top: 6px; right: -21px;
    display: block;
    width: 16px;
    height: 16px;
    background: #fff url(../../../images/loading.gif) no-repeat center center;
  }

  &.fetching-error {

    input { border: 2px solid @red; }
  }
}

.navigator-filter-load-more {
  display: none;
  height: 26px;
  line-height: 26px;
  background-color: @grey;
  text-align: center;
  cursor: pointer;
  transition: background 0.3s ease;

  &:hover {
    background-color: darken(@grey, 7%);
  }
}

.navigator-filter-favorite {
  position: relative;
}

.navigator-filter-favorite-toggle {
  width: 16px;
  height: @navigatorFiltersHeight;
  background: url(../../../images/navigator/favorite-filters@2x.png) no-repeat center center;
  background-size: 16px 14px;
}

.navigator-filter-more-criteria {
  font-size: @baseFontSize;
}
